import {
  mapGetters
} from 'vuex'
export default {
//此文件主要是讲底部购物车num数封装变更
  computed: {
    ...mapGetters('cart', ['total'])
  },
  watch: {
    total: {
      handler(newval) {
       uni.setTabBarBadge({
         index: 2,
         text: '' + this.total
       })
      },
      deep: true,
      immediate: true, //立即监听
    }
  },
  onLoad() {
    uni.setTabBarBadge({
      index: 2,
      text: '' + this.total
    })
  }
}
